<template>
	<view>
		<view class="message-list">
			<roc-scroll @loadData="loadData" :visible_height="visible_height" :hasMore="hasMore"
				refresher_background="#f5f5f5" :data_number="data_number" :solt_height="solt_height"
				background="#f5f5f5" footer_background="#f5f5f5">
				<view class="" slot="data-content">
					<view class="item-message" @click="toDetail"  v-for="(item,index) in data" :key="index">
						<view class="message-type">
							<view class="message-title">{{item.title}} <view :class="item.status == 1?'status':'status nosucces'">{{item.status == 1?'已办理':'待办'}}</view>
								<!-- <view class="status nosucces">待办</view> -->
							</view>
							<view class="message-info">
								客户名称：{{item.name}}
								<view class="" style="margin-left: 30rpx;">
									位置：{{item.address}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</roc-scroll>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 滚动数据初始化
				visible_height: 60,
				solt_height: 0,
				page: 0,
				hasMore: true,
				data: [],
				data_number: 0,
				type:0
			}
		},
		onLoad(option) {
			this.type = option.type
			this.loadData(0)
		},
		methods: {
			toDetail() {
				uni.navigateTo({
					url: '/otherpages/message/systemDetail'
				})
			},
			loadData(type,callback){
				if(type == 1){
					this.page = 0
				}
				let url = {
					url:'message/getTechnicianMessageList',
					method: "get"
				}
				this.request.httpTokenRequest(url, {
					page:this.page
				}).then(res => {
					if (res.code == 0) {
						this.data =[...this.data,...res.data.data]
						this.data_number = this.data.length
						this.page++
						uni.hideLoading()
						if (type) callback(false)
					} else {
						this.$util.msg(res.msg)
						return
					}
				}, error => {})
			}
		}
	}
</script>

<style lang="scss">
	.message-list {
		padding: 30rpx;
	}

	.item-message {

		height: 139rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 30rpx;
		box-sizing: border-box;
		margin-bottom: 30rpx;

		.message-type {
			width: 100%;

			// margin-left: 45rpx;
			.message-title {
				font-size: 28rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #08090A;
				display: flex;
				align-items: center;
				justify-content: space-between;
				width: 100%;

				.status {
					width: 88rpx;
					height: 40rpx;
					background: #E2E2E2;
					border-radius: 10rpx;
					font-size: 26rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #6D6F6F;
					text-align: center;
					line-height: 40rpx;
					margin-left: auto;
				}

				.nosucces {
					background-color: #FCDBD4;
					color: #EF4C28;
				}

			}

			.message-info {
				font-size: 22rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #A3A3A3;
				display: flex;
				align-items: center;
				margin-top: 10rpx;
			}
		}
	}
</style>